package tech.aistar.util.verified;


import sun.misc.BASE64Encoder;

import java.io.*;

/**
 * 照片的B64编码
 */
public class B64 {

    public static String encodeImgageToBase64(File imageFile) {
// 读取图片字节数组
        byte[] data = null;
        try {
            InputStream in = new FileInputStream(imageFile);
            data = new byte[in.available()];
            in.read(data);
            in.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
        BASE64Encoder encoder = new BASE64Encoder();
        return encoder.encode(data);// 返回Base64编码过的字节数组字符串
    }


}
